package com.study.newjava8.annotation;

import org.junit.Test;
import org.springframework.lang.NonNull;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.util.SortedMap;

public class TestAnnotation {


    @Test
    public void test1() throws Exception {
        Class<TestAnnotation> clazz = TestAnnotation.class;
        Method m1 = clazz.getMethod("show", String.class);
        MyAnnotation[] ma = m1.getAnnotationsByType(MyAnnotation.class);
        for (int i = 0; i < ma.length; i++) {
            String value = ma[i].value();
            System.out.println(value);
        }
        Annotation[] annotations = m1.getAnnotations();
        System.out.println(annotations);
    }

    @MyAnnotation("Hello")
    @MyAnnotation("Wolrd")
    public void show(@MyAnnotation @NonNull String a){
    }
}
